import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { TestModule } from '@/module/test/test.module';

import configuration from '@/config/index';
import { PermissionGuard } from '@/common/guards/permission.guard';
import { APP_GUARD } from '@nestjs/core';

import { AppController } from '@/app.controller';

@Module({
  imports: [
    // 配置模块
    ConfigModule.forRoot({
      cache: true,
      load: [configuration],
      isGlobal: true,
    }),
    TestModule,
  ],
  controllers: [AppController],
  providers: [
    {
      provide: APP_GUARD,
      useClass: PermissionGuard,
    },
  ],
})
export class AppModule {}
